import { Sex, CalorieComputingModel } from "./model/calory-calculator.model";


export class CaloryCalculator {
    calculate(sex: Sex, age: number, weight: number): number {
        const situations: Array<CalorieComputingModel> = [
            new CalorieComputingModel(Sex.male, 1, 17, 14.1, 380),
            new CalorieComputingModel(Sex.male, 18, 30, 15.2, 680),
            new CalorieComputingModel(Sex.male, 31, 60, 11.5, 830),
            new CalorieComputingModel(Sex.male, 61, 160, 13.4, 490),

            new CalorieComputingModel(Sex.femal, 1, 17, 13.2, 320),
            new CalorieComputingModel(Sex.femal, 18, 30, 14.6, 450),
            new CalorieComputingModel(Sex.femal, 31, 60, 8.6, 830),
            new CalorieComputingModel(Sex.femal, 61, 160, 10.4, 600)
        ];
        return situations.find(calory => calory.sex === sex && age >= calory.minAge && age <= calory.maxAge).calculate(weight);
    }

}
